package com.tky.conference.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;

import com.tky.conference.R;
import com.tky.conference.dao.AppointInfo;
import com.tky.conference.dao.ComeetingInfo;

import java.util.List;

/**
 * Created by cll on 2015/12/22.
 */
public class MyConferencePubAdapter extends BaseAdapter {
    private Context context;
    private List<ComeetingInfo> comeetingInfoList;

    public MyConferencePubAdapter(Context context,List<ComeetingInfo> comeetingInfoList){
        this.context=context;
        this.comeetingInfoList=comeetingInfoList;
    }

    @Override
    public int getCount() {
        return comeetingInfoList.size();
    }

    @Override
    public Object getItem(int i) {
        return getItem(i);
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int position, View view, ViewGroup viewGroup) {
        ViewHolder holder=null;
        final ComeetingInfo comeetingInfo=comeetingInfoList.get(position);
        if (view==null){
            view= View.inflate(context, R.layout.activity_item, null);
            holder=new ViewHolder();
            holder.project= (TextView) view.findViewById(R.id.project);
            holder.destination= (TextView) view.findViewById(R.id.destination);
            holder.appoint= (TextView) view.findViewById(R.id.appoint);
            holder.time= (TextView) view.findViewById(R.id.time);
            view.setTag(holder);
        }else {
            holder= (ViewHolder) view.getTag();
        }
        holder.project.setText(comeetingInfo.getHyzt());
        holder.destination.setText(comeetingInfo.getHydd());
        holder.appoint.setText(comeetingInfo.getStatus());
        holder.time.setText(comeetingInfo.getStime());

        return view;
    }




    class ViewHolder{
        TextView project;
        TextView time;
        TextView appoint;
        TextView destination;
    }
}
